package com.nettytime.util.testjiebaonianbaos;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

public class NettyClientHandler  extends ChannelInboundHandlerAdapter {

    @Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception {
        //发送消息到服务端
        ctx.writeAndFlush("232301FE393031323835303730303030303030303001001E160C0F0B061B000438393836303242363033313730303230313830340100A5");
    }

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        //接收服务端发送过来的消息
        System.out.println("收到服务端" + ctx.channel().remoteAddress() + "的消息：" + msg);
    }

}
